export { default as modal } from "./Modal.vue"
import { ref } from "vue"

export const useModal = (callback: any = null) => {
  const currentModal: any = ref(null);
  const openModal = (data) => {
    if (callback) {
      callback(data);
    }
    currentModal.value.exposed.open();
  }
  const closeModal = () => {
    currentModal.value.exposed.close();
  }
  const registerModal = (instance: any) => {
    currentModal.value = instance;
  }
  return {
    openModal, closeModal, registerModal
  }
}
